home *** CD-ROM | disk | FTP | other *** search
/ EuroCD 3 / EuroCD 3.iso / Programming / Amos / AMOSList-1097 / AMOSLIST / text0113.txt < prev    next >
Encoding:
Text File  |  1998-06-24  |  2.5 KB  |  97 lines

  1. On 07-Oct-97, MtL ManUtd wrote:
  2. >can anybody show me a little example on how the hunt command works?
  3.  
  4. I've been a bit distracted lately, but I found a short example
  5. that might be useful as an example. I have not seen any other
  6. responses, but if you already have the hang of HUNTing, just
  7. smack the old delete button.
  8.  
  9. The following code strips out the less than usefull elements
  10. of an 8SVX file, correcting several common problems in the
  11. process, and rewrites it. The PSVX routine uses HUNT to locate
  12. the header and body chunks of the just processed file to play
  13. it. Note that the PSVX routine knows it has been passed a
  14. bank with a good iff 8svx form, so it doesn't error check.
  15.  
  16. Hope this helps, (or at least doesnt get in your way)
  17. -Richard
  18.  
  19. ' signatures for sample files
  20. Global SIGFORM,SIG8SVX,SIGVHDR,SIGBODY
  21. LCONST["FORM"] : SIGFORM=Param
  22. LCONST["8SVX"] : SIG8SVX=Param
  23. LCONST["VHDR"] : SIGVHDR=Param
  24. LCONST["BODY"] : SIGBODY=Param
  25. ' audio fade variables 
  26. B$=Fsel$("**")
  27. If B$="" Then Stop 
  28. Open In 1,B$
  29. X=Lof(1)+42
  30. Close 1
  31. Reserve As Work 10,X
  32. Reserve As Work 11,X
  33. '
  34. STRIPSVX[B$]
  35. '
  36. Procedure STRIPSVX[N$]
  37.    'Follow I,L,J,K
  38.    A$=" " : A$=A$+A$+A$+A$
  39.    I=Start(10)
  40.    NI=Start(11)
  41.    Bload N$,Start(10)
  42.    If Leek(I)=SIGFORM and Leek(I+8)=SIG8SVX
  43.       Print "FORM ";
  44.       Add I,4
  45.       L=Leek(I)
  46.       Print " Len ";L;" ";
  47.       Add I,4
  48.       Copy Start(10),Start(10)+12 To NI : Add NI,12
  49.       For J=1 To 4 : Print Chr$(Peek(I)); : Add I,1 : Next J : Print 
  50.       T=Start(10)+L
  51.       While I<T
  52.          If Leek(I)=SIGVHDR or Leek(I)=SIGBODY
  53.             Print "rewriting . . . ";
  54.             CL=Leek(I+4)+8
  55.             Copy I,I+CL To NI
  56.             If(CL mod 2)=1 : Inc CL : End If 
  57.             NI=NI+CL
  58.          Else 
  59.             Print "skipping . . .  ";
  60.          End If 
  61.          Print "Chunk ";
  62.          For J=1 To 4 : Print Chr$(Peek(I)); : Add I,1 : Next J
  63.          K=Leek(I)
  64.          Print " Len ";K
  65.          Add K,4
  66.          If(K mod 2)=1 : Inc K : End If 
  67.          Add I,K
  68.       Wend 
  69.       Loke Start(11)+4,NI-Start(11)-8
  70.       PSVX
  71.       Bsave N$,Start(11) To NI
  72.    Else 
  73.       Print "Not an IFF FORM"
  74.    End If 
  75. End Proc
  76. '
  77. Procedure LCONST[A$]
  78.    A=Leek(Varptr(A$))
  79. End Proc[A]
  80. '
  81. Procedure PSVX
  82.    Voice %111
  83.    Volume %1000,63
  84.    If Leek(Start(11))=SIGFORM and Leek(Start(11)+8)=SIG8SVX
  85.       SBEG=Hunt(Start(11) To Start(11)+64,"VHDR")
  86.       SLEN=Leek(SBEG+8)+Leek(SBEG+12)
  87.       SRATE=Deek(SBEG+20)
  88.       SBEG=Hunt(SBEG To SBEG+512,"BODY")
  89.       SBEG=SBEG+8
  90.       Sam Raw %1000,SBEG,SLEN,SRATE
  91.    End If 
  92. End Proc
  93. '
  94.  
  95.  
  96.  
  97.